﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

using System.Web.Mvc;


namespace Wicresoft.SMS.Web
{
    public delegate MvcHtmlString RenderTemplateDelegate();

    /// <summary>
    /// the metadata description of authorise control framework
    /// </summary>
    public class AuthorisedMetadataModel
    {        
        /// <summary>
        /// Authorise Provider which decide the behavior of the control
        /// </summary>
        private IAuthorise _authoriseProvider;
        /// <summary>
        /// the authorise flag of control which indicates permissions value(some bit combination)
        /// </summary>
        public AuthoriseFlag Flag { get; set; }
        /// <summary>
        /// indicate which user the control assigned to
        /// </summary>
        public string User { get; set; }
        /// <summary>
        /// indicate the control type of the control
        /// </summary>
        public ControlType ControlType { get; set; }
        /// <summary>
        /// display info of control
        /// </summary>
        public string Display { get; set; }
        /// <summary>
        /// PropertyName of control which is usually used in input tag
        /// </summary>
        public string PropertyName { get; set; }
        /// <summary>
        /// PropertyValue of control which is usually used in input tag
        /// </summary>
        public object PropertyValue { get; set; }
        /// <summary>
        /// indicate the post back value binding property
        /// </summary>
        public string Binding { get; set; }

        public void SetAuthoriseProvider(IAuthorise provider , AuthorisedMetadataModel model)
        {
            _authoriseProvider = provider;
            _authoriseProvider.model = model;
        }

        public IAuthorise GetAuthoriseProvider()
        {
            return _authoriseProvider;
        }
    }
}